package com.bms.client.controller;

import com.bms.client.pojo.DuiWaiXinXiJiaoLiu;
import com.bms.client.pojo.DuiWaiXinXiJiaoLiuChanXun;
import com.bms.client.service.impl.DuiWaiXinXiJiaoLiuServiceImpl;
import com.bms.client.utils.RedisUtils;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

/**
 * 对外信息交流(DuiWaiXinXiJiaoLiu)表控制层
 *
 * @author makejava
 * @since 2021-03-19 10:41:20
 * @version 1.0
 */
@RestController
@RequestMapping("duiWaiXinXiJiaoLiu")
@Api(value = "对外信息交流(DuiWaiXinXiJiaoLiu)管理",tags = "对外信息交流(DuiWaiXinXiJiaoLiu)管理接口API")
@ApiResponses({
        @ApiResponse(code=400,message="请求参数不完整或者错误"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code=406,message="页面地址和接口名冲突"),
        @ApiResponse(code=415,message="请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code=500,message="后台服务逻辑错误")
})
public class DuiWaiXinXiJiaoLiuController {
    /**
     * 服务对象
     */
    @Resource
    private DuiWaiXinXiJiaoLiuServiceImpl duiWaiXinXiJiaoLiuServiceImpl;

    @Resource
    private RedisUtils redisUtils;

    /**
     * 通过主键查询单条数据
     * @return 单条数据
     */
    @RequestMapping(value = "chaXunFenYe", method = RequestMethod.POST)
    @ApiOperation(value = "列表查询分页接口",notes = "列表查询分页接口",httpMethod = "POST")
    public Map<String, Object> chaXunFenYe(@RequestBody @ApiParam(name = "duiWaiXinXiJiaoLiuChanXun",value = "pojo模型",required = true) @Valid DuiWaiXinXiJiaoLiuChanXun duiWaiXinXiJiaoLiuChanXun) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Map<String,String> map=new HashMap<>();
        map.put("riQi","*"+duiWaiXinXiJiaoLiuChanXun.getRiQi()+"*");
        return redisUtils.redisPage(duiWaiXinXiJiaoLiuChanXun.getPage(),"duiWaiXinXiJiaoLiu",map);
    }



}